package com.googlecode.xcache.transcode;

/**
 * {@link TransCoder} is used to customize some data transcoding (if needed)
 * into and/or out of the underlying MemcachedClient.
 * 
 * @author tielei
 *
 */
public interface TransCoder {
	/**
	 * Encode value.
	 * @param value original value to encode.
	 * @return encoded value (may be the same as the original value).
	 */
	Object encode(final Object value);
	/**
	 * Decode value.
	 * @param <T>
	 * @param expectedValueClass expected type of  value.
	 * @param value encoded value.
	 * @return original value with expected type.
	 */
	<T> T decode(final Class<T> expectedValueClass, final Object value);
}
